﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class Xing : MonoBehaviour
{

    public static int score = 0;
    public static Text tex;

    private float distance;

    void Start()
    {
        tex = GameObject.Find("Text").GetComponent<Text>();
    }
    private void OnCollisionEnter2D(Collision2D coll)
    {
        distance = Vector2.Distance(coll.transform.position, this.transform.position);
        if (distance <= 5)
        {
            Destroy(this.gameObject);
            score++;
        }
    }

}